<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>

<%
HttpSession sesja = request.getSession(true);
if(sesja.getAttribute("log")!=null && sesja.getAttribute("log").equals("pracownik")){%>
	<div class=kontakt>
	<br>
	<div class=formularz>
	<fieldset class=obrys>
	<%if(sesja.getAttribute("lang").equals("en")){%>
	<%if(request.getParameter("stage")!=null && request.getParameter("stage").equals("2")){%>
		<img src='images/kurier.png' width=20% height=20%>
		<h3>Check your order</h3>
		<table class=opcje >
		<tr>
			<td align="center" valign="middle"> 
				<table style="border:solid 1px black" bgcolor="#BDEDFF">
				<tr><th width=180px; cellspan="2">Sender:</th></tr>
				<tr><td>Name:</td><td><%out.println(request.getParameter("imie").toString());%></td></tr>
				<tr><td>Surname:</td><td><%out.println(request.getParameter("nazwisko").toString());%></td></tr>
				<tr><td>Address:</td><td><%out.println(request.getParameter("adres").toString());%></td></tr>
				<tr><td>Postal code:</td><td><%out.println(request.getParameter("kod").toString());%></td></tr>
				<tr><td>City:</td><td><%out.println(request.getParameter("miasto").toString());%></td></tr>
				<tr><th width=180px; cellspan="2">Recipient:</th></tr>
				<tr><td>Name:</td><td><%out.println(request.getParameter("imie2").toString());%></td></tr>
				<tr><td>Surname:</td><td><%out.println(request.getParameter("nazwisko2").toString());%></td></tr>
				<tr><td>Address:</td><td><%out.println(request.getParameter("adres2").toString());%></td></tr>
				<tr><td>Postal code:</td><td><%out.println(request.getParameter("kod2").toString());%></td></tr>
				<tr><td>City:</td><td><%out.println(request.getParameter("miasto2").toString());%></td></tr>
				<tr><th width=180px; cellspan="2">Informations about package:</th></tr>
				<tr><td>Payment:</td><td><%out.println(request.getParameter("wynik").toString());%> zł</td></tr>
				<tr><td>Payment by the recipient:</td><td><%if(request.getParameter("pobranie")!=null) out.println(request.getParameter("pobranie_wartosc").toString()); else out.println("0.00");%> zł</td></tr>
				<tr><td>Additional comments:</td><td><%if(request.getParameter("uwagi")!=null) out.println(request.getParameter("uwagi").toString()); else out.println("none");%></td></tr>
				</table>
			</td>
		</tr>
		</table>
				<br/>
					<form id=nadawanie name=nadawanie method=post action=#>
						<input type='hidden' id='identyfikator' name='identyfikator' value='<%if(request.getParameter("identyfikator")!=null) out.println(request.getParameter("identyfikator").toString()); else out.println("none");%>' />
						<input type='hidden' id='imie' name='imie' value='<%out.println(request.getParameter("imie"));%>' />
						<input type='hidden' id='nazwisko' name='nazwisko' value='<%out.println(request.getParameter("nazwisko"));%>' />
						<input type='hidden' id='adres' name='adres' value='<%out.println(request.getParameter("adres"));%>' />
						<input type='hidden' id=kod name=kod value='<%out.println(request.getParameter("kod"));%>' />
						<input type='hidden' id='miasto' name='miasto' value='<%out.println(request.getParameter("miasto"));%>'/>
						<input type='hidden' id='imie2' name='imie2' value='<%out.println(request.getParameter("imie2"));%>' />
						<input type='hidden' id='nazwisko2' name='nazwisko2' value='<%out.println(request.getParameter("nazwisko2"));%>' />
						<input type='hidden' id='adres2' name='adres2' value='<%out.println(request.getParameter("adres2"));%>' />
						<input type='hidden' id=kod2 name=kod2 value='<%out.println(request.getParameter("kod2"));%>' />
						<input type='hidden' id='miasto2' name='miasto2' value='<%out.println(request.getParameter("miasto2"));%>'/>
						<input type='hidden' id='wynik' name='wynik' value='<%out.println(request.getParameter("wynik"));%>'/>
						<input type='hidden' id='pobranie' name='pobranie' value='<%if(request.getParameter("pobranie")!=null) out.println(request.getParameter("pobranie_wartosc").toString()); else out.println("0.00");%>'/>
						<input type='hidden' id='uwagi' name='uwagi' value='<%if(request.getParameter("uwagi")!=null) out.println(request.getParameter("uwagi").toString()); else out.println("none");%>' />
						<input class=przycisk type='button' id='lang' name='lang' value='Save' onClick='Nadawanie2()'>
						<input class=przycisk type='button' name='clean' value='Cancel' onClick='javascript:window.location = "index.jsp";'>
						<input class=przycisk type='button' name='clean' value='Back' onClick='history.back();'>
					</form>		
	<%}else{%>	
	<img src='images/kurier.png' width=20% height=20%>
	<form id=rejestracja name=rejestracja method=post onSubmit='Nadawanie()' action=#>	
		<table class=opcje >
		<tr>
			<td align="center" valign="middle"> 
				<table cellspacing='20px'>
				<tr>
					<td></td>
					<td>Sender:</td>					
					<td>Recipient:</td>
				<tr>				
				<tr>
					<td>Id:</td>				
					<td><input type="text" id='identyfikator' name='identyfikator' value='brak' onClick='szukajID()' readonly></td>
					<td><input type="button" value='clean ID' onClick='czyscID()' id='id'></td>
				</tr>
				<tr>
					<td>Name:</td>
					<td><input type='text' id='imie' size='20' name='imie'/></td>
					<td><input type='text' id='imie2' size='20' name='imie2'/></td>
					<td id=td1></td>
				</tr>
				<tr>
					<td>Surname:</td>
					<td><input type='text' id='nazwisko' size='20' name='nazwisko'/></td>
					<td><input type='text' id='nazwisko2' size='20' name='nazwisko2'/></td>
					<td id=td2></td>
				</tr>
				<tr>
					<td>Address:</td>
					<td><input type='text' id='adres' size='20' name='adres'/></td>
					<td><input type='text' id='adres2' size='20' name='adres2'/></td>
					<td id=td3></td>
				</tr>
				<tr>
					<td>Postal code:</td>
					<td><input type='text' size='20' name='kod' id=kod onKeyPress='TylkoKodPocztowy(event)'/></td>
					<td><input type='text' size='20' name='kod2' id=kod2 onKeyPress='TylkoKodPocztowy2(event)'/></td>
					<td id=td4></td>	
				</tr>
				<tr>
					<td>City:</td>
					<td><input type='text' size='20' id='miasto' name='miasto'/></td>
					<td><input type='text' size='20' id='miasto2' name='miasto2'/></td>
					<td id=td5></td>
				</tr>
				</table>
			</td>
		</tr>
		</table>
	<br/>
	<table class=opcje >
		<tr>
			<td align="center" valign="middle"> 	
			<table cellspacing='20px'>
				<tr>
					<td width=180px;>Package weight (kg):</td><td><input type='text' id='waga' name='waga' size='25' onKeyPress='TylkoLiczby(event)'/></td><td>&nbsp;</td>
				</tr>
				<tr>
					<td>Insurance:</td><td align="center"><input type='checkbox' id='ubezpieczenie' onClick='Ubezpieczenie2()' /></td><td id=td2></td>
				</tr>
				<tr>
					<td>Package value (PLN):</td><td align="center"><input type='text' id='wartosc' size='25' onKeyPress='TylkoLiczby(event)' disabled/></td>
				</tr>	
				<tr>
					<td>Payment by the recipient:</td><td align="center"><input type='checkbox' id='pobranie' onClick='Pobranie()'/></td>
				</tr>
				<tr>
					<td>Value of the payment (PLN):</td><td align="center"><input type='text' id='pobranie_wartosc' name='pobranie_wartosc' size='25' onKeyPress='TylkoLiczby(event)' disabled/></td><td  align="center" id=td6>&nbsp;</td>
				</tr>
				<tr>
					<td>Shipment packaging:</td><td align="center"><input type='checkbox' id='pakowanie'/></td>
				</tr>	
				<tr>
					<td>Additional comments:</td><td align="center"><textarea style="height:50px; width:25" name='uwagi' id='uwagi'></textarea></td>
				</tr>
				<tr>
					<td><input class=przycisk type='button' id='ok' name='ok' value='Count' onClick='Kalkuluj2(0,false)' style='width:100px'></td><td><input type='text' id='wynik' name='wynik' value='brak' size='25' readonly/></td>
				</tr>	
			</table>
			</td>
		</tr>
	</table>
	<br/><br/>
	<input class=przycisk type='button' name='clean' value='Continue' onClick='Nadawanie()' style='width:100px' id='lang'>
	<input class=przycisk type='button' name='clean' value='Clean' onClick='this.form.reset()' style='width:100px'>
	</form>
	<br/>	
	<%}}else{%>
	<%if(request.getParameter("stage")!=null && request.getParameter("stage").equals("2")){%>
		<img src='images/kurier.png' width=20% height=20%>
		<h3>Sprawdź dane zamówienia</h3>
		<table class=opcje >
		<tr>
			<td align="center" valign="middle"> 
				<table style="border:solid 1px black" bgcolor="#BDEDFF">
				<tr><th width=180px; cellspan="2">Dane nadawacy:</th></tr>
				<tr><td>Imie:</td><td><%out.println(request.getParameter("imie").toString());%></td></tr>
				<tr><td>Nazwisko:</td><td><%out.println(request.getParameter("nazwisko").toString());%></td></tr>
				<tr><td>Adres:</td><td><%out.println(request.getParameter("adres").toString());%></td></tr>
				<tr><td>Kod:</td><td><%out.println(request.getParameter("kod").toString());%></td></tr>
				<tr><td>Miasto:</td><td><%out.println(request.getParameter("miasto").toString());%></td></tr>
				<tr><th width=180px; cellspan="2">Dane odbiorcy:</th></tr>
				<tr><td>Imie:</td><td><%out.println(request.getParameter("imie2").toString());%></td></tr>
				<tr><td>Nazwisko:</td><td><%out.println(request.getParameter("nazwisko2").toString());%></td></tr>
				<tr><td>Adres:</td><td><%out.println(request.getParameter("adres2").toString());%></td></tr>
				<tr><td>Kod:</td><td><%out.println(request.getParameter("kod2").toString());%></td></tr>
				<tr><td>Miasto:</td><td><%out.println(request.getParameter("miasto2").toString());%></td></tr>
				<tr><th width=180px; cellspan="2">Informacje o paczce:</th></tr>
				<tr><td>Opłata:</td><td><%out.println(request.getParameter("wynik").toString());%> zł</td></tr>
				<tr><td>Pobranie:</td><td><%if(request.getParameter("pobranie")!=null) out.println(request.getParameter("pobranie_wartosc").toString()); else out.println("0.00");%> zł</td></tr>
				<tr><td>Dodatkowe uwagi:</td><td><%if(request.getParameter("uwagi")!=null) out.println(request.getParameter("uwagi").toString()); else out.println("brak");%></td></tr>
				</table>
			</td>
		</tr>
		</table>
				<br/>
					<form id=nadawanie name=nadawanie method=post action=#>
						<input type='hidden' id='identyfikator' name='identyfikator' value='<%if(request.getParameter("identyfikator")!=null) out.println(request.getParameter("identyfikator").toString());%>' />
						<input type='hidden' id='imie' name='imie' value='<%out.println(request.getParameter("imie"));%>' />
						<input type='hidden' id='nazwisko' name='nazwisko' value='<%out.println(request.getParameter("nazwisko"));%>' />
						<input type='hidden' id='adres' name='adres' value='<%out.println(request.getParameter("adres"));%>' />
						<input type='hidden' id=kod name=kod value='<%out.println(request.getParameter("kod"));%>' />
						<input type='hidden' id='miasto' name='miasto' value='<%out.println(request.getParameter("miasto"));%>'/>
						<input type='hidden' id='imie2' name='imie2' value='<%out.println(request.getParameter("imie2"));%>' />
						<input type='hidden' id='nazwisko2' name='nazwisko2' value='<%out.println(request.getParameter("nazwisko2"));%>' />
						<input type='hidden' id='adres2' name='adres2' value='<%out.println(request.getParameter("adres2"));%>' />
						<input type='hidden' id=kod2 name=kod2 value='<%out.println(request.getParameter("kod2"));%>' />
						<input type='hidden' id='miasto2' name='miasto2' value='<%out.println(request.getParameter("miasto2"));%>'/>
						<input type='hidden' id='wynik' name='wynik' value='<%out.println(request.getParameter("wynik"));%>'/>
						<input type='hidden' id='pobranie' name='pobranie' value='<%if(request.getParameter("pobranie")!=null) out.println(request.getParameter("pobranie_wartosc").toString()); else out.println("0.00");%>'/>
						<input type='hidden' id='uwagi' name='uwagi' value='<%if(request.getParameter("uwagi")!=null) out.println(request.getParameter("uwagi").toString()); else out.println("brak");%>' />
						<input class=przycisk type='button' id='lang' name='lang' value='Zapisz' onClick='Nadawanie2()'>
						<input class=przycisk type='button' name='clean' value='Anuluj' onClick='javascript:window.location = "index.jsp";'>
						<input class=przycisk type='button' name='clean' value='Wróć' onClick='history.back();'>
					</form>		
	<%}else{%>	
	<img src='images/kurier.png' width=20% height=20%>
	<form id=rejestracja name=rejestracja method=post onSubmit='Nadawanie()' action=#>	
		<table class=opcje >
		<tr>
			<td align="center" valign="middle"> 
				<table cellspacing='20px'>
				<tr>
					<td></td>
					<td>Dane nadawcy:</td>					
					<td>Dane odbiorcy:</td>
				<tr>				
				<tr>
					<td>Identyfikator:</td>				
					<td><input type="text" id='identyfikator' name='identyfikator' value='brak' onClick='szukajID()' readonly></td>
					<td><input type="button" value='czyść ID' onClick='czyscID()' id='id'></td>
				</tr>
				<tr>
					<td>Imię:</td>
					<td><input type='text' id='imie' size='20' name='imie'/></td>
					<td><input type='text' id='imie2' size='20' name='imie2'/></td>
					<td id=td1></td>
				</tr>
				<tr>
					<td>Nazwisko:</td>
					<td><input type='text' id='nazwisko' size='20' name='nazwisko'/></td>
					<td><input type='text' id='nazwisko2' size='20' name='nazwisko2'/></td>
					<td id=td2></td>
				</tr>
				<tr>
					<td>Adres:</td>
					<td><input type='text' id='adres' size='20' name='adres'/></td>
					<td><input type='text' id='adres2' size='20' name='adres2'/></td>
					<td id=td3></td>
				</tr>
				<tr>
					<td>Kod pocztowy:</td>
					<td><input type='text' size='20' name='kod' id=kod onKeyPress='TylkoKodPocztowy(event)'/></td>
					<td><input type='text' size='20' name='kod2' id=kod2 onKeyPress='TylkoKodPocztowy2(event)'/></td>
					<td id=td4></td>	
				</tr>
				<tr>
					<td>Miasto:</td>
					<td><input type='text' size='20' id='miasto' name='miasto'/></td>
					<td><input type='text' size='20' id='miasto2' name='miasto2'/></td>
					<td id=td5></td>
				</tr>
				</table>
			</td>
		</tr>
		</table>
	<br/>
	<table class=opcje >
		<tr>
			<td align="center" valign="middle"> 	
			<table cellspacing='20px'>
				<tr>
					<td width=180px;>Waga przesyłki (kg):</td><td><input type='text' id='waga' name='waga' size='25' onKeyPress='TylkoLiczby(event)'/></td><td>&nbsp;</td>
				</tr>
				<tr>
					<td>Ubezpieczenie:</td><td align="center"><input type='checkbox' id='ubezpieczenie' onClick='Ubezpieczenie2()' /></td><td id=td2></td>
				</tr>
				<tr>
					<td>Wartość paczki (PLN):</td><td align="center"><input type='text' id='wartosc' size='25' onKeyPress='TylkoLiczby(event)' disabled/></td>
				</tr>	
				<tr>
					<td>Pobranie:</td><td align="center"><input type='checkbox' id='pobranie' name='pobranie' value='true' onClick='Pobranie()'/></td>
				</tr>
				<tr>
					<td>Wartość pobrania (PLN):</td><td align="center"><input type='text' id='pobranie_wartosc' name='pobranie_wartosc' size='25' onKeyPress='TylkoLiczby(event)' disabled/></td><td  align="center" id=td6>&nbsp;</td>
				</tr>
				<tr>
					<td>Pakowanie paczki:</td><td align="center"><input type='checkbox' id='pakowanie'/></td>
				</tr>	
				<tr>
					<td>Dodatkowe uwagi:</td><td align="center"><textarea style="height:50px; width:25" name='uwagi' id='uwagi'></textarea></td>
				</tr>
				<tr>
					<td><input class=przycisk type='button' id='ok' name='ok' value='Oblicz' onClick='Kalkuluj2(0,false)' style='width:100px'></td><td><input type='text' id='wynik' name='wynik' value='brak' size='25' readonly/></td>
				</tr>	
			</table>
			</td>
		</tr>
	</table>
	<br/><br/>
	<input class=przycisk type='button' name='clean' value='Kontynuuj' onClick='Nadawanie()' style='width:100px' id='lang'>
	<input class=przycisk type='button' name='clean' value='Wyczyść' onClick='this.form.reset()' style='width:100px'>
	</form>
	<br/>
	
	<%}}%>
	</fieldset>
	</div>
	</div>
<%}else{
	if(sesja.getAttribute("lang").equals("en")){%>
		<br><img src="images/stop.png" width=30% height=30%><br><br>
		<h1>ACCESS DANIED</h1><br>
		You don't have permission to access this page.<br>
		<%if(!sesja.getAttribute("log").equals("admin") && !sesja.getAttribute("log").equals("klient")) %>Log in first.
		<br><br>	
	<%}else{ %>
		<br><img src="images/stop.png" width=30% height=30%><br><br>
		<h1>DOSTĘP ZABRONIONY</h1><br>
		Nie masz uprawnień do oglądania tej strony.<br>
		<%if(!sesja.getAttribute("log").equals("admin") && !sesja.getAttribute("log").equals("klient")) %>Zaloguj się najpierw.
		<br><br>
<%}}%>
</body>
</html>